package com.zbkj.crmeb.enums;

import com.fasterxml.jackson.annotation.JsonCreator;

/**
 * @author lvmd
 * @Description: 用户优惠券状态
 * @date 2022-01-18
 */
public enum CouponUseStatusEnum {
    /**
     * 可用
     */
    USABLE(0, "未使用"),

    /**
     * 已使用
     */
    USED(1, "已使用"),

    /**
     * 无效
     */
    DISABLES(2, "已失效");

    private final Integer code;
    private final String msg;

    CouponUseStatusEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    @JsonCreator
    public static CouponUseStatusEnum valueOf(Integer code) {
        for (CouponUseStatusEnum value : values()) {
            if (code.equals(value.getCode())) {
                return value;
            }
        }
        return CouponUseStatusEnum.DISABLES;
    }

}

